1. Field of the Invention
The present invention relates to a moving image conversion device and its method for converting a moving image into a color reduction moving image, a moving image distribution device for distributing a moving image to a mobile terminal device or the like, an e-mail relay device for relaying an e-mail, to which a moving image is attached, and sending the e-mail to a transmission destination, and a program for causing a computer to execute the moving image conversion method.
2. Description of the Related Art
Images obtained with digital cameras, scanners or the like can be represented in 8-bit colors for each of the RGB colors, which are 24-bit colors in total. In other words, the images can be represented in approximately 16.77 million colors. However, some image reproduction devices can reproduce a smaller number of colors (for example, 256 colors). Further, image formats such as gif (Graphic Interchange Format) and png (Portable Network Graphic), which are frequently used in websites, can process only 256 colors. Therefore, when the images, which were obtained with the digital cameras or the like, are displayed at the reproduction devices, which can reproduce a smaller number of colors, or the images are converted to image formats such as gif and png, color reduction processing is required to reduce the number of colors from 16.77 million to 256.
Conventionally, the color reduction processing as described above is performed by generating palette data representing palette colors of 256 colors, which are optimal colors for representing a color reduction processing object image in 256 colors. A color, into which the color of each pixel should be converted, is selected from the palette colors represented by the palette data, and color reduction processing is performed on each pixel.
Further, a method is proposed, wherein when moving images are obtained with digital video cameras, color reduction processing is performed on the moving images in real time, and images with movement (hereinafter called color reduction moving images) are produced by displaying still images consecutively in switching them (Japanese Unexamined Patent Publication No. 11(1999)-259640). In this method, the color reduction processing is performed by generating palette data for every few frames instead of each frame. A single set of palette data is used to perform color reduction processing on every few frames so that the color reduction processing is performed in real time without dropping any frames included in the moving image, which change every 1/60 second.
Here, in some cases, gradations in images are lost when color reduction processing is performed on the images. For example, if the palette data does not include orange, but includes only red and yellow, an orange area in an original image, which is represented by original image data before color reduction processing, can be represented only in red or yellow. Therefore, the orange area in the original image cannot be reproduced as an orange area in a color reduction moving image.
Therefore, color reduction processing is performed on the orange area using error diffusion processing. In the error diffusion processing, red pixels and yellow pixels are produced in the area in appropriate ratios to each other. Accordingly, although when each pixel is seen, the color of the pixel is red or yellow, when the area is seen as a whole, the color of the area is pseudo-orange.
The color reduction processing using error diffusion processing will be described below. FIGS. 19A and 19B are diagrams for explaining the color reduction processing using error diffusion processing. FIG. 19A illustrates the arrangement of pixels in an original image, which is represented by original data. FIG. 19B illustrates the arrangement of pixels in a processed image, which is represented by processed data, on which error diffusion processing has been performed. Here, to simplify the explanation, it is assumed that the original image includes 5×3 pixels, and the position of each pixel is represented by using (x, y) coordinates. It is also assumed that the pixel (1, 1) at the upper left corner is a start point in FIG. 19A, and the color reduction processing is performed by performing error diffusion processing in the x direction and moving a pixel string, on which error diffusion processing is performed, in the y direction at the same time. It is also assumed that the palette data includes only four values of 10, 20, 30 and 40.
FIG. 20 illustrates an example of a matrix for error diffusion processing. As illustrated in FIG. 20, a matrix T0 for error diffusion processing is used to diffuse an error generated at a pixel (namely, a pixel corresponding to the center of the matrix, called P0), which is a color reduction processing object, to four neighboring pixels at the right side, the lower right side, the lower side and the lower left side of the pixel P0 in the ratios of 7/16, 3/16, 5/16, and 1/16, respectively. Since error diffusion processing has been already performed on neighboring pixels at the upper left side, the upper side, the upper right side and the left side of the pixel P0, the elements at the upper left side, the upper side, the upper right side and the left side of the element at the center of the matrix T0 do not have any values.
In the original data as illustrated in FIG. 19A, the pixel value of the pixel (1, 1) is 24. Therefore, the pixel value of the pixel (1, 1) is changed to 20, which is the closest value to 24 among the values included in the palette data. Accordingly, an error of 4 is generated at the pixel (1, 1), and the error of 4 is diffused to pixels (2, 1), (2, 2), and (1, 2) in the ratios of 7/16, 3/16, and 5/16, respectively. Next, color reduction processing is performed on the pixel (2, 1). In the original data, the pixel value of the pixel (2, 1) was 24. However, since a value of 7×4/16 has been added to 24 in the error diffusion processing performed on the pixel (1, 1), the pixel value of the pixel (2, 1) is 25.75. Therefore, the pixel value of the pixel (2, 1) is changed to 30, which is the closest value to 25.75 among the values included in the palette data. Accordingly, an error of −4.25 is generated at the pixel (2, 1), and the error of −4.25 is diffused to pixels (3, 1), (3, 2), (2, 2), and (1, 2) in the ratios of 7/16, 3/16, 5/16, and 1/16, respectively. Then, color reduction processing using error diffusion processing is sequentially performed on all of the pixels, and processed data can be obtained.
Here, each of the pixels in the original image has a pixel value of 23 to 27, but each of the pixels in the processed image has a pixel value of 20 or 30. However, the pixels having the pixel value of 20 and the pixels having the pixel value of 30 are produced in appropriate ratios to each other. Therefore, although there is no pixel, which has a pixel value between 20 and 30, in the processed image, pseudo gradations in the range of pixel values between 23 and 27 in the original data can be reproduced.
Meanwhile, functions of mobile terminal devices such as cellular camera phones are rapidly improving, and communication speeds thereof are improving. Therefore, mobile terminal devices have been proposed, which can capture moving images and send the captured moving images by attaching them to e-mails, or access moving image distribution servers, which distribute moving image contents, and download and reproduce desired moving image contents.
Further, although functions are limited to still images, an e-mail relay device has been proposed, which can perform appropriate image processing on images attached to e-mails, which were sent from a mobile terminal device with a camera, based on the model type of a terminal device at a destination, (U.S. Patent Laid-Open No. 20040105119). By using the e-mail relay device as described above, image processing may be performed on image data so that an image is produced, which is appropriate for an image size, the brightness of a display, a color tone, or the like of the mobile terminal device at the destination, and an e-mail, to which the image is attached, can be sent.
The color reduction moving images may be produced from the moving images by the method disclosed in Japanese Unexamined Patent Publication No. 11(1999)-259640. However, there is demand for production of high quality color reduction moving images by using the characteristics of the moving images.